package com.zmn.plat.common.dictionary;

/**
 * 结算规则
 *
 * @author xiangjunming
 * @since 2019 /08/20 14:47:16
 */
public enum ChannelFinancialRulesEnum {

    /**
     * values
     */
    SF(1, "收付实现制"),
    ZQ(2, "权责发生制"),
    ;

    /**
     * 收付实现制
     */
    public static final int CONSTS_SF = 1;
    /**
     * 权责发生制
     */
    public static final int CONSTS_ZQ = 2;

    private Integer code;
    private String name;

    ChannelFinancialRulesEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelFinancialRulesEnum of(Integer code) {
        if(code == null){
            return null;
        }
        switch (code) {
            case 1:
                return SF;
            case 2:
                return ZQ;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelFinancialRulesEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
